package com.ewing.busi.carry.dto;

import java.util.List;
import java.util.Map;

import com.ewing.busi.carry.model.WebCarryWay;
import com.ewing.busi.sysparam.constants.SysParamRootCodes;
import com.ewing.busi.sysparam.dto.SysParamManager;
import com.google.common.collect.Lists;

/**
 * 
 * @author chenxuegui.cxg@alibaba-inc.com
 * @createDate 2016年9月4日
 */
public class WebCarryWayDto {

  private String carryWay;

  private List<Integer> resIdList;

  /**
   * 首N件
   */
  private Integer firstAmount;

  /**
   * 首费
   */
  private Float firstFee;

  /**
   * 续M件
   */
  private Integer secAmount;

  /**
   * 续费
   */
  private Float secFee;


  public static List<WebCarryWayDto> to(List<WebCarryWay> wayList,
      Map<Integer, List<Integer>> tempId2resIdList) {
    List<WebCarryWayDto> dtoList = Lists.newArrayList();
    for (WebCarryWay way : wayList) {
      WebCarryWayDto dto = new WebCarryWayDto();
      dto.carryWay =
          SysParamManager.getInstance(SysParamRootCodes.CARRY_WAY).getCode(way.getCarryWay());
      dto.firstAmount = way.getFirstAmount();
      dto.firstFee = way.getFirstFee();
      dto.secAmount = way.getSecAmount();
      dto.secFee = way.getSecFee();
      dto.resIdList = tempId2resIdList.get(way.getCarryTemplateId());
      dtoList.add(dto);
    }
    return dtoList;
  }


  public List<Integer> getResIdList() {
    return resIdList;
  }

  public void setResIdList(List<Integer> resIdList) {
    this.resIdList = resIdList;
  }

  public String getCarryWay() {
    return carryWay;
  }

  public void setCarryWay(String carryWay) {
    this.carryWay = carryWay;
  }

  public Integer getFirstAmount() {
    return firstAmount;
  }

  public void setFirstAmount(Integer firstAmount) {
    this.firstAmount = firstAmount;
  }

  public Float getFirstFee() {
    return firstFee;
  }

  public void setFirstFee(Float firstFee) {
    this.firstFee = firstFee;
  }

  public Integer getSecAmount() {
    return secAmount;
  }

  public void setSecAmount(Integer secAmount) {
    this.secAmount = secAmount;
  }

  public Float getSecFee() {
    return secFee;
  }

  public void setSecFee(Float secFee) {
    this.secFee = secFee;
  }


}
